cmake_minimum_required (VERSION 2.8)

set(Boost_INCLUDE_DIR /boost/include)

include_directories (include)
include_directories(${BOOST_INCLUDEDIR})
INCLUDE_DIRECTORIES($(Boost_INCLUDE_DIR))

find_package(Threads)

find_package(Boost
            1.55.0
            COMPONENTS  system
                        filesystem
                        regex
                        thread
            REQUIRED)

add_library (lib_pi
                pi.cpp
                ${CMAKE_SOURCE_DIR}/include/pi.h)
add_library (lib_gpio
                GPIO.cpp
                ${CMAKE_SOURCE_DIR}/include/GPIO.h)
add_library (lib_serial_port
                SerialPort.cpp
                ${CMAKE_SOURCE_DIR}/include/SerialPort.hpp)
add_library (lib_packet
                Packet.cpp
                ${CMAKE_SOURCE_DIR}/include/Packet.hpp)
add_library (lib_transmit_packet
                TransmitPacket.cpp
                ${CMAKE_SOURCE_DIR}/include/TransmitPacket.hpp)
add_library (lib_boost
                main.cpp
                ${BOOST_LIBRARYDIR})
add_library (lib_explicit_addressing_packet
                ExplicitAddressingPacket.cpp
                ${CMAKE_SOURCE_DIR}/include/ExplicitAddressingPacket.hpp)


add_executable (main  main.cpp)
target_link_libraries (main
                        lib_pi
                        lib_serial_port
                        lib_gpio
                        lib_packet
                        lib_transmit_packet
                        lib_explicit_addressing_packet
                        lib_boost
                        rt
                        ${Boost_SYSTEM_LIBRARY}
                        ${Boost_THREAD_LIBRARY}
                        ${Boost_REGEX_LIBRARY}
                        ${Boost_FILESYSTEM_LIBRARY}
                        ${CMAKE_THREAD_LIBS_INIT})


# Where to move things on 'install' command
install (TARGETS  main  DESTINATION  ${CMAKE_SOURCE_DIR}/bin)